import { ArticleModel } from './../model/article.model';
import { Component } from "react";
import { FormHelper } from '../form-helper';
import articleService from '../service/article.service';

export interface IArticleProps { 
    model: ArticleModel;
    name: string;
}
export class Article extends Component<IArticleProps> { 
    onSubmit = async (formFieldsValues: any) => {
        console.log(formFieldsValues);
        let article = await articleService.save(formFieldsValues);
        alert("添加完成");
        console.log(article);
    }
    render() { 
        return FormHelper.create(this.props.model, this.props.name, this.onSubmit);
    }
}

export default Article;